@import './vars.less';
@import './mixins.less';
@import './playerMobile.less';
@import './audioListsPanel.less';
@import '~rc-slider/assets/index.css';
@import '~rc-switch/assets/index.css';

.react-jinke-music-player-main {
    touch-action: none;
    font-family: "Microsoft YaHei UI";

    ::-webkit-scrollbar-thumb {
        height: 20px;
        background-color: @primary-color;
        opacity: 0.5;
    }

    ::-webkit-scrollbar {
        width: @scroll-bar-width;
        background-color: @bg-color;
    }

    .rc-switch {
        &:focus {
            box-shadow: none;
        }
    }

    .lyric-btn {
        svg {
            font-size: 20px;
        }

        &-active {
            &,
            svg {
                color: @primary-color !important;
            }
        }
    }

    .music-player-lyric {
        position: fixed;
        color: @player-lyric-color;
        font-size: @player-lyric-font-size;
        cursor: move;
        z-index: @player-lyric-z-index;
        bottom: @music-player-panel-height + 20px;
        width: 100%;
        left: 0;
        text-align: center;
        transition: box-shadow @common-animate-time;
        background: transparent;
        text-shadow: 0 1px 1px rgba(255, 255, 255, 0.05);

        @media @mobile {
            font-size: @player-lyric-font-size-mobile;
            z-index: @player-lyric-z-index-mobile;
        }
    }

    .play-mode-title {
        user-select: none;
        position: fixed;
        right: 72px;
        bottom: @music-player-panel-height;
        padding: 5px 20px;
        background-color: rgba(0, 0, 0, 0.5);
        color: #fff;
        line-height: 1.5;
        text-align: center;
        transform: translate3d(100%, 0, 0);
        transform-origin: bottom center;
        z-index: @mode-tip-z-index;
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: all @common-animate-time;

        &.play-mode-title-visible {
            opacity: 1;
            visibility: visible;
            pointer-events: all;
            transform: translate3d(0, 0, 0);
        }
    }

    .glass-bg-container {
        position: absolute;
        background-position: center;
        background-repeat: no-repeat;
        background-size: cover;
        width: 300%;
        height: 300%;
        left: 0;
        top: 0;
        filter: blur(80px);
        z-index: -1;
    }

    .glass-bg {
        backdrop-filter: blur(10px);
    }

    svg {
        font-size: 24px;
        transition: color @common-animate-time;

        &:hover,
        &:active {
            color: @primary-color;
        }
    }

    @media @mobile {
        svg {
            font-size: 22px;
        }
    }

    .react-jinke-music-player-mode-icon {
        animation: scaleTo @common-animate-time;
    }

    .music-player-panel {
        box-shadow: 0 0 3px #403f3f;
        @panel-height: @music-player-panel-height;
        position: fixed;
        width: 100%;
        bottom: 0;
        left: 0;
        color: #fff;
        height: @panel-height;
        background-color: @panel-bg-dark;
        z-index: 99;
        transition: background-color @common-animate-time;

        .panel-content {
            height: 100%;
            padding: 0 30px;
            position: relative;
            overflow: hidden;
            .center();

            .overwrite-progress-bar();

            .img-content {
                width: 50px;
                height: 50px;
                border-radius: 50%;
                overflow: hidden;
                background-size: 100%;
                background-repeat: no-repeat;
                box-shadow: 0 0 10px rgba(0, 34, 77, 0.05);
                cursor: pointer;

                @media @mobile {
                    width: 40px;
                    height: 40px;
                }

                img {
                    width: 100%;
                }
            }

            .img-rotate {
                animation: imgRotate 15s linear infinite;
            }

            .hide-panel,
            .upload-music {
                flex-basis: 10%;
                cursor: pointer;
                margin-left: 15px;
            }

            @media @mobile {
                .progress-bar-content {
                    .hidden();
                }
            }

            .progress-bar-content {
                flex: 1;
                padding: 0 20px;
                overflow: hidden;

                .audio-title {
                    transition: color @common-animate-time;
                    .ellipsis-1();
                    display: inline-block;
                    width: 100%;
                }

                .audio-main {
                    width: 100%;
                    display: inline-flex;
                    justify-content: center;
                    margin-top: 6px;

                    .current-time,
                    .duration {
                        font-size: 12px;
                        flex-basis: 5%;
                        transition: color @common-animate-time;
                    }
                }

                .progress-bar {
                    flex: 1 1 auto;
                    width: 100%;
                    margin: 2px 20px 0 20px;
                    position: relative;

                    .progress {
                        position: absolute;
                        display: inline-block;
                        height: @progress-bar-height;
                        left: 0;
                        top: 0;
                        transition: width @common-animate-time;
                        background: linear-gradient(135deg,
                        rgba(0, 0, 0, 0) 0%,
                        rgba(0, 0, 0, 0) 31%,
                        rgba(0, 0, 0, 0.05) 33%,
                        rgba(0, 0, 0, 0.05) 67%,
                        rgba(0, 0, 0, 0) 69%);
                        background-color: @primary-color;

                        .progress-change {
                            position: absolute;
                            width: 10px;
                            height: 10px;
                            right: 0;
                            bottom: -2px;
                            border-radius: 50%;
                            box-shadow: 0 0 2px rgba(0, 0, 0, 0.4);
                            background-color: #fff;
                            cursor: pointer;
                        }
                    }

                    .progress-load-bar {
                        position: absolute;
                        width: 0%;
                        height: @progress-bar-height - 1px;
                        background-color: @progress-load-bar-bg-color;
                        transition: width, background-color @common-animate-time;
                        left: 0;
                        top: 5px;
                        z-index: @progress-load-bar-z-index;
                        border-radius: 6px;
                    }

                    .rc-slider-track {
                        z-index: @progress-load-bar-z-index+1;
                    }

                    .rc-slider-handle {
                        z-index: @progress-load-bar-z-index+2;
                    }
                }
            }

            .player-content {
                padding-left: 5%;
                display: inline-flex;
                align-items: center;
                align-content: center;
                flex-basis: 15%;

                > .group {
                    &,
                    & > svg {
                        cursor: pointer;
                    }

                    .group {
                        display: flex;
                    }

                    text-align: center;
                    flex: 1;
                    margin: 0 10px;
                    display: inline-flex;
                    justify-content: center;
                    align-items: center;

                    @media @mobile {
                        margin: 0 6px;
                    }

                    @media screen and (max-width: 320px) {
                        margin: 0 4px;
                    }

                    > i {
                        cursor: pointer;
                        color: @primary-color;
                        font-size: 25px;
                        vertical-align: middle;
                    }
                }

                .theme-switch {
                    .rc-switch {
                        background-color: transparent;
                    }
                }

                @media @mobile {
                    .play-sounds {
                        .hidden();
                    }
                }

                .prev-audio,
                .next-audio {
                    svg {
                        font-size: 35px;
                    }
                }

                .loading-icon {
                    padding: 0 18px;
                }

                .play-btn {
                    padding: 0 18px;

                    svg {
                        font-size: 26px;
                    }
                }

                .loop-btn {
                    &.active {
                        color: @primary-color;
                    }
                }

                .play-sounds {
                    align-items: center;

                    svg {
                        font-size: 28px;
                    }

                    .sounds-icon {
                        display: flex;
                        margin-right: 15px;
                        flex: 1 1 auto;
                    }

                    .sound-operation {
                        width: 100px;
                    }
                }

                .destroy-btn {
                    svg {
                        font-size: 28px;
                    }
                }

                .audio-lists-btn {
                    user-select: none;
                    min-width: 60px;
                    height: 28px;
                    border-radius: 40px;
                    background-color: rgba(0, 0, 0, 0.3);
                    padding: 0 10px;
                    box-shadow: 0 0 1px 1px rgba(255, 255, 255, 0.02);
                    position: relative;
                    transition: color, background-color @common-animate-time;

                    .audio-lists-icon {
                        display: flex;
                    }

                    > .group:hover {
                        &,
                        & > svg {
                            color: @primary-color;
                        }
                    }

                    .audio-lists-num {
                        margin-left: 8px;
                    }
                }
            }
        }

        .rc-switch-inner {
            svg {
                font-size: 13px;
            }
        }
    }

    .rc-slider-rail {
        background-color: @progress-bar-bg-color-dark !important;
        transition: background-color @common-animate-time;
    }

    &.light-theme {
        svg {
            color: @primary-color;

            &:hover,
            &:active {
                color: lighten(@primary-color, 5%);
            }
        }

        .rc-slider-rail {
            background-color: @progress-bar-bg-color-light !important;
        }

        .music-player-controller {
            border-color: @primary-color-light;
            background-color: @controller-bg-light;
        }

        .music-player-panel {
            box-shadow: 0 1px 2px 0 rgba(0, 34, 77, 0.05);
            background-color: @panel-bg-light;
            color: #7d7d7d;

            .img-content {
                box-shadow: 0 0 10px #dcdcdc;
            }

            .progress-load-bar {
                background-color: @progress-load-bar-bg-color-light !important;
            }
        }

        .rc-switch {
            color: #fff;

            &::after {
                background-color: #fff;
            }
        }

        .rc-switch-checked {
            background-color: @primary-color !important;
            border: 1px solid @primary-color;
        }

        .rc-switch-inner {
            color: #fff;
        }

        .audio-lists-btn {
            background-color: @bg-color !important;

            &:hover,
            &:active {
                color: @font-color;
                background-color: lighten(@bg-color, 2%);
            }

            > .group:hover {
                &,
                & > svg {
                    color: @font-color;
                }
            }
        }

        .audio-lists-panel {
            color: @font-color;
            background-color: @lists-panel-item-bg-light;
            box-shadow: 0 0 2px #dcdcdc;

            .audio-item {
                background-color: @lists-panel-item-bg-light;

                &:nth-child(2n + 1) {
                    background-color: @lists-panel-item-bg-active-light !important;
                }

                &.playing {
                    background-color: @lists-panel-item-bg-playing-light !important;

                    &,
                    svg {
                        color: @primary-color !important;
                    }
                }

                @media @mobile {
                    background-color: @lists-panel-item-bg-light !important;

                    &.playing {
                        background-color: @lists-panel-item-bg-playing-light !important;

                        &,
                        svg {
                            color: @primary-color !important;
                        }
                    }
                }
            }
        }

        .audio-lists-panel-header {
            color: @font-color;
            background-color: @primary-color-light;
            border-bottom: 1px solid #f4f4f7;

            &-line {
                background-color: #f4f4f7;
            }
        }

        .audio-item {
            box-shadow: 0 0 2px transparent !important;
            border-bottom: 1px solid rgba(220, 220, 220, 0.26);
            background-color: rgba(64, 68, 75, 0.65);

            &:hover,
            &:active {
                background-color: darken(@lists-panel-item-bg-light, 2%) !important;

                svg {
                    color: @primary-color;
                }
            }

            &.playing {
                background-color: darken(@lists-panel-item-bg-light, 2%) !important;

                svg {
                    color: @primary-color;
                }

                .player-singer {
                    color: @primary-color !important;
                }
            }

            .player-singer {
                color: @lists-panel-item-signer-color-light !important;
            }
        }

        .react-jinke-music-player-mobile {
            background-color: @panel-bg-light;
            color: @font-color;

            &-cover {
                border: 5px solid transparent;
                box-shadow: 0 0 30px 2px rgba(0, 0, 0, 0.2);
            }

            .current-time,
            .duration {
                color: @font-color;
            }

            .rc-slider-rail {
                background-color: #e9e9e9;
            }

            &-operation {
                svg {
                    color: @font-color;
                }
            }

            &-tip {
                svg {
                    color: #fff !important;
                }
            }

            &-singer {
                &-name {
                    color: @font-color;
                    transition: color @common-animate-time;

                    &::before,
                    &::after {
                        background-color: @font-color;
                    }
                }
            }
        }

        .play-mode-title {
            background-color: @panel-bg-light;
            color: @primary-color;
        }
    }
}

.react-jinke-music-player {
    position: fixed;
    width: @player-width;
    height: @player-height;
    z-index: @player-mini-z-index;

    @media @mobile {
        width: @player-width-mobile;
        height: @player-height-mobile;
    }

    &:focus {
        outline: none;
    }

    .music-player {
        cursor: pointer;
        position: relative;
        width: @player-width;
        height: @player-height;

        @media @mobile {
            width: @player-width-mobile;
            height: @player-height-mobile;
        }

        &:focus {
            outline: none;
        }

        &-audio {
            .hidden();
        }

        .destroy-btn {
            z-index: 100;
            position: absolute;
            right: 0;
            top: 0;

            @media @mobile {
                right: -3px;
            }
        }

        &-controller {
            width: @player-width;
            height: @player-height;
            border-radius: 50%;
            border: 1px solid @controller-bg-dark;
            background-color: @controller-bg-dark;
            color: @primary-color;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.15);
            font-size: 20px;
            .text-center();
            .transition(0.3s);
            z-index: 99;
            padding: 10px;
            position: fixed;
            cursor: pointer;
            background-repeat: no-repeat;
            background-size: 100%; // animation: imgRotate 15s linear infinite;
            &:focus {
                outline: none;
            }

            &.music-player-playing {
                &::before {
                    content: '';
                    position: fixed;
                    width: @player-width;
                    height: @player-height;
                    border: 1px solid rgba(255, 255, 255, 0.2);
                    border-radius: 50%;
                    z-index: -1;
                    animation: scale 5s linear infinite;
                    cursor: pointer;
                }
            }

            @media @mobile {
                & {
                    width: @player-width-mobile;
                    height: @player-height-mobile;

                    &.music-player-playing {
                        &::before {
                            width: @player-width-mobile;
                            height: @player-height-mobile;
                        }
                    }
                }
            }

            .center();

            i {
                font-size: 28px;
            }

            &:active {
                box-shadow: 0 0 30px rgba(0, 0, 0, 0.2);
            }

            &:hover {
                font-size: 16px;

                .music-player-controller-setting {
                    transform: scale(1);
                }
            }

            .controller-title {
                font-size: 14px;
            }

            @media @mobile {
                i {
                    font-size: 20px;
                }

                &:hover,
                &:active {
                    font-size: 12px;

                    .music-player-controller-setting {
                        transform: scale(1);
                    }
                }
            }

            .music-player-controller-setting {
                width: 100%;
                height: 100%;
                background: fade(@primary-color, 30%);
                transform: scale(0);
                border-radius: 50%;
                .transition(0.4s);
                color: #fff;
                position: absolute;
                left: 0;
                top: 0;
                .center();
            }
        }
    }

    .audio-circle-process-bar {
        stroke-width: 3px;
        stroke-linejoin: round;
        pointer-events: none;
        width: @player-width;
        height: @player-height;
        position: absolute;
        left: 0;
        top: -@player-width;
        z-index: 100;
        animation: scaleTo @common-animate-time;

        circle[class='bg'] {
            stroke: #fff;
        }

        circle[class='stroke'] {
            stroke: @primary-color;
        }

        &,
        circle {
            transition: stroke-dasharray @common-animate-time;
            transform: matrix(0, -1, 1, 0, 0, 80);

            @media @mobile {
                transform: matrix(0, -1, 1, 0, 0, 60);
            }
        }
    }
}
